-- @owner: lihongji
-- @date: 2022/07/26
-- @testpoint: ||/|测试
-- @history: Modified by li-xin12345 2024/12/20：研发代码变更，精度变化

--step1:建序列;expect:成功
drop sequence if exists pop_samp_variance_seq_avgx;
create sequence pop_samp_variance_seq_avgx increment by 1 start with 10;

--step2:建表并插入数据;expect:成功
drop table if exists table_0001 cascade;
create table table_0001(
  col_1 integer,
  col_2 number(19,0),
  col_3 number(10,6)
) with (storage_type=ustore);
begin
 for i in 1..50 loop
  insert into table_0001 values(
  i,
  pop_samp_variance_seq_avgx.nextval,
  i+445.255
  );
 end loop;
end;
/

--step3:查询;expect:成功
select regr_avgx(case when col_2>10 then col_2 else col_1 end,case when col_2>10 then col_2 else col_1 end)||regr_avgx(cos(col_1)*exp(col_3/100)/ln(col_2),cos(col_1)*exp(col_3/100)/ln(col_2)) from table_0001 order by 1;
select regr_avgx(case when col_2>10 then col_2 else col_1 end,case when col_2>10 then col_2 else col_1 end)|regr_avgx(cos(col_1)*exp(col_3/100)/ln(col_3),cos(col_1)*exp(col_3/100)/ln(col_2)) from table_0001 order by 1;

--step4:清理环境;expect:成功
drop sequence if exists pop_samp_variance_seq_avgx;
drop table if exists table_0001 cascade;